package com.hanserwei.han_picture.domain.entity.po;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * 图片
 */
@Schema(description = "图片")
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "picture")
@Builder
public class Picture implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "id")
    private Long id;

    /**
     * 图片 url
     */
    @TableField(value = "url")
    @Schema(description = "图片 url")
    private String url;

    /**
     * 图片名称
     */
    @TableField(value = "`name`")
    @Schema(description = "图片名称")
    private String name;

    /**
     * 简介
     */
    @TableField(value = "introduction")
    @Schema(description = "简介")
    private String introduction;

    /**
     * 分类
     */
    @TableField(value = "category")
    @Schema(description = "分类")
    private String category;

    /**
     * 标签(JSON 数组)
     */
    @TableField(value = "tags")
    @Schema(description = "标签(JSON 数组)")
    private String tags;

    /**
     * 图片体积
     */
    @TableField(value = "pic_size")
    @Schema(description = "图片体积")
    private Long picSize;

    /**
     * 图片宽度
     */
    @TableField(value = "pic_width")
    @Schema(description = "图片宽度")
    private Integer picWidth;

    /**
     * 图片高度
     */
    @TableField(value = "pic_height")
    @Schema(description = "图片高度")
    private Integer picHeight;

    /**
     * 图片宽高比例
     */
    @TableField(value = "pic_scale")
    @Schema(description = "图片宽高比例")
    private Double picScale;

    /**
     * 图片格式
     */
    @TableField(value = "pic_format")
    @Schema(description = "图片格式")
    private String picFormat;

    /**
     * 创建图片的用户 id
     */
    @TableField(value = "user_id")
    @Schema(description = "创建图片的用户 id")
    private Long userId;

    /**
     * 审核状态: 0-待审核, 1-通过, 2-拒绝
     */
    @TableField(value = "review_status")
    @Schema(description = "审核状态: 0-待审核, 1-通过, 2-拒绝")
    private Integer reviewStatus;

    /**
     * 审核信息
     */
    @TableField(value = "review_message")
    @Schema(description = "审核信息")
    private String reviewMessage;

    /**
     * 审核人 id
     */
    @TableField(value = "reviewer_id")
    @Schema(description = "审核人 id")
    private Long reviewerId;

    /**
     * 审核时间
     */
    @TableField(value = "review_time")
    @Schema(description = "审核时间")
    private LocalDateTime reviewTime;

    /**
     * 缩略图Url
     */
    @TableField(value = "thumbnail_url")
    @Schema(description = "缩略图Url")
    private String thumbnailUrl;

    /**
     * 所属的空间 id(为空表示公共空间)
     */
    @TableField(value = "space_id")
    @Schema(description = "所属的空间 id(为空表示公共空间)")
    private Long spaceId;

    /**
     * 图片主色调(支持颜色搜索)
     */
    @TableField(value = "pic_color")
    @Schema(description = "图片主色调(支持颜色搜索)")
    private String picColor;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    /**
     * 编辑时间
     */
    @TableField(value = "edit_time")
    @Schema(description = "编辑时间")
    private LocalDateTime editTime;

    /**
     * 更新时间
     */
    @TableField(value = "update_time")
    @Schema(description = "更新时间")
    private LocalDateTime updateTime;

    /**
     * 是否删除
     */
    @TableField(value = "is_delete")
    @Schema(description = "是否删除")
    @TableLogic
    private Integer isDelete;

    /**
     * 权限列表
     */
    @Schema(description = "图片权限列表")
    @TableField(exist = false)
    private List<String> permissionList = new ArrayList<>();
}